package net.bolue.sysmng.tblbean;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;


/**
 * 数据表信息
 * @author Administrator
 *
 */
public class TblInfo extends TableBean{
	
	private static final Map<String,String> map=new HashMap<String,String>();
	static{
		map.put("subSys","SUBSYS");
		map.put("tblName","TBLNAME");
		map.put("tblDesc","TBLDESC");
		map.put("remark","REMARK");
	}
	
	/**
	 * 子系统
	 */
	private String subSys;
	
	/**
	 * 数据表名
	 */
	private String tblName;
	
	/**
	 * 数据表描述
	 */
	private String tblDesc;
	
	/**
	 * 备注
	 */
	private String remark;
	
	public String getSubSys() {
		return subSys;
	}

	public void setSubSys(String subSys) {
		this.subSys = subSys;
	}

	public String getTblName() {
		return tblName;
	}

	public void setTblName(String tblName) {
		this.tblName = tblName;
	}

	public String getTblDesc() {
		return tblDesc;
	}

	public void setTblDesc(String tblDesc) {
		this.tblDesc = tblDesc;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public static Map<String, String> getMap() {
		return map;
	}

	@Override
	public TableBean mapToEntry(Map<String, Object> map) {
		TblInfo tblInfo = new TblInfo();
		/*
		Map<String,String> pcMap = propColMap();
		Set<String> pcSet = pcMap.keySet();
		Iterator<String> pcIt = pcSet.iterator();
		while(pcIt.hasNext()){
			String prop = pcIt.next();
			String col = pcMap.get(prop);
			Object value = map.get(col);
		}
		*/
		
		Set<String> keySet = map.keySet();
		Iterator<String> keyIt = keySet.iterator();
		while(keyIt.hasNext()){
			String key = keyIt.next();
			Object o = map.get(key);
			if("SUBSYS".equals(key)){
				tblInfo.setSubSys((String)o);
			} else if("TBLNAME".equals(key)){
				tblInfo.setTblName((String)o);
			} else if("TBLDESC".equals(key)){
				tblInfo.setTblDesc((String)o);
			} else if("REMARK".equals(key)){
				tblInfo.setRemark((String)o);
			}
		}
		return tblInfo;
	}

	
	@Override
	public String tableName() {
		return "st_tblinfo";
	}

	@Override
	public String keyProps() {
		return "subSys,tblName";
	}

	@Override
	public Map<String,String> propColMap() {
		return map;
	}
	
}
